import java.util.Scanner;

public class test2 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        while (true) {
            System.out.println("请输入城市,首字母大写(输入-1退出)");
            String city = scan.next();
            if(city.equals("-1")){
                break;
            }
            System.out.println("请输入交通工具");
            String transport = scan.next();

            int price = getprice(city,transport);
            if(price==0){
                System.out.println("免费");
            }else {
                System.out.println(price);
            }
        }

    }

    private static int getprice(String city, String transport) {
        int price = 0;
        if(transport.equals("bike")){
            return 0;
        }
        switch (city){
            case "Beijing" :{
                if(transport.equals("Subway")){
                    price=2;
                }
                else if(transport.equals("Taxi")){
                    price=30;
                }
                else{
                    System.out.println("没有这个交通工具");
                    price=-1;
                }
                break;
            }
            case "Shanghai" :{
                if(transport.equals("Subway")){
                    price=3;
                }
                else if(transport.equals("Taxi")){
                    price=40;
                }
                else{
                    System.out.println("没有这个交通工具");
                    price=-1;
                }
                break;
            }
            case "Guangzhou" :{
                if(transport.equals("Subway")){
                    price=2;
                }
                else if(transport.equals("Taxi")){
                    price=25;
                }
                else{
                    System.out.println("没有这个交通工具");
                    price=-1;
                }
                break;
            }
            case "Shenzhen" :{
                if(transport.equals("Subway")){
                    price=2;
                }
                else if(transport.equals("Taxi")){
                    price=35;
                }
                else{
                    System.out.println("没有这个交通工具");
                    price=-1;
                }
                break;
            }
            default:{
                System.out.println("该城市不在范围内");
                return -1;
            }
        }
        return price;
    }

}
